﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WBasicClassLib.ExtFunctions.ExtObject;

namespace ExtObject_Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("\"Hello\".In(\"Hello\", \"World\", \"!\") ：");
            Console.WriteLine("Hello".In("Hello", "World", "!"));

            Console.WriteLine("\"季节\".In(\"春\", \"夏\", \"秋\", \"冬\") ：");
            Console.WriteLine("季节".In("春", "夏", "秋", "冬"));

            Console.WriteLine("检查1是否在int[] 中，int[] 集合中的数值为1, 2、3、4、5");
            int[] Collection = new int[] { 1, 2, 3, 4, 5 };
            Console.WriteLine(1.In(Collection));

            Console.WriteLine("判断3是否在2～3的范围：");
            Console.WriteLine(3.InRange(2, 3));
            Console.WriteLine("判断3.14是否在3.13～3.15的范围：");
            Console.WriteLine(3.14.InRange(3.13, 3.15));
            Console.WriteLine("判断今天是否在2000年1月1日～2009年1月1日的范围：");
            Console.WriteLine(DateTime.Now.InRange(new DateTime(2000, 1, 1), new DateTime(2009, 1, 1)));
            Console.WriteLine("判断牛B是否在牛A和牛C之间：");
            Console.WriteLine("牛B".InRange("牛A", "牛C"));

            Console.WriteLine("遍历List集合：");
            List<Pair> NameSpaces = new List<Pair>
                                                            {
                                                                new Pair{Key = "1", Value = "Logger"}, 
                                                                new Pair{Key = "2", Value = "IniByXml"}, 
                                                                new Pair{Key = "3", Value = "Helper"}, 
                                                                new Pair{Key = "4", Value = "ExtFunctions"}
                                                            };
            Console.WriteLine("原集合内容：");
            NameSpaces.ForEach(i => { Console.Write(i.Value + " "); });
            Console.WriteLine();
            Console.WriteLine("修改后内容：");
            NameSpaces.ForEach(i => i.Value = "WBasicClassLib." + i.Value);
            NameSpaces.ForEach(i => { Console.Write(i.Value + " "); });
            Console.WriteLine();

            Console.ReadLine();
        }

        class Pair
        {
            public string Key { get; set; }
            public string Value { get; set; }
        }
    }
}
